import yaml
import configparser
from utils.get_filepath import get_yaml_path, get_ini_path

path = get_yaml_path()
ini_path = get_ini_path()


def read_yaml():
    with open(path, encoding="utf-8") as f:
        data = yaml.safe_load(f)
        return data

    # 文件打开的第二种方式，这种方式需要释放一个文件流
    # f = open("C:/Users/大东/PycharmProjects/pythonProjec/WebAutoTest/data/data.yaml", encoding="utf-8")
    # data = yaml.safe_load(f)
    # f.close()
    # return data


def read_ini():
    config = configparser.ConfigParser()
    config.read(ini_path, encoding='utf-8')
    return config


if __name__ == '__main__':
    # print(read_yaml()["skill"][1])
    print(read_ini()["mysql"])
